#include "Test.Application.h"

#undef  APP_NAME
#define APP_NAME	TestLoadProgramApplication
#undef  APP_BASE
#define APP_BASE	TestApp


class APP_NAME : public APP_BASE
{
// variables
protected:


// methods
public:
	APP_NAME (IPlatform *platform, EDevice::type deviceType) :
		APP_BASE( platform, deviceType )
	{}
	
	void OnEnter () override
	{
		APP_BASE::OnEnter();

		ProgramPtr	prog;

		const Program::ProgramLoadParams	params( "0123456789abcdef" );

		ESS()->GetResourceManager()->Load( EResource::PROGRAM, "prog/prog1", prog, params );
		/*
		prog = Program::New( ESS() );

		ShaderProgram &	sp = prog->GetShaderProgram();
		
		Shader  vs( gl_shader::VERTEX ),
				fs( gl_shader::FRAGMENT );


		const char	vs_src[] = TOSTRING(
				attribute vec2	inPosition;
				attribute vec4  inColor;
				varying vec4    vColor;
				void main ()
				{
					gl_Position = vec4( inPosition, 0.0, 1.0 );
					vColor      = inColor;
				}
			);

		const char	fs_src[] = TOSTRING(
				uniform int   channel;
				varying vec4  vColor;
				void main ()
				{
					(channel == 0 ? gl_FragColor = vec4(vColor.r) :
					(channel == 1 ? gl_FragColor = vec4(vColor.g) :
					(channel == 2 ? gl_FragColor = vec4(vColor.a) : gl_FragColor = vColor )))
				}
			);

		vs.SetSource( vs_src );
		vs.Compile();
		vs.ShowLog();

		fs.SetSource( fs_src );
		fs.Compile();
		fs.ShowLog();

		sp.Attach( fs );
		sp.Attach( vs );
		sp.Link();
		sp.ShowLog();*/
	}
};